import {RouteRecordRaw} from 'vue-router'
import HomePage from "../../view/HomePage.vue";
import Good from "../../view/Goods/Good.vue";
import GoodList from '../../view/Goods/GoodList.vue'
import GoodList_New from '../../view/Goods/GoodList_New.vue'
import GoodItemList from '../../view/Goods/GoodItemList.vue'
import UserMain from "../../view/User/UserMain.vue";
import ShopCart from "../../view/User/cart/ShopCart.vue";
import HistoricalOrderList from "../../view/User/cart/HistoricalOrderList.vue";
import HistoricalOrder from "../../view/User/cart/HistoricalOrder.vue";
import ToSubmitOrder from "../../view/User/cart/ToSubmitOrder.vue";
import UserInfo from "../../view/User/UserInfo.vue";
import StarGoodList from "../../view/Goods/StarGoodList.vue";
import UserPhone from "../../view/User/UserPhone.vue";
import UserMail from "../../view/User/UserMail.vue";
import UserAddress from "../../view/User/UserAddress.vue";
import PaySuccess from "../../view/other/PaySuccess.vue";
import SelfDefinePage from "../../view/other/SelfDefinePage.vue";
import PayFail from "../../view/other/PayFail.vue";
import AuthLayout from "../../view/Auth/AuthLayout.vue";
import Login from "../../view/Auth/Login.vue";
import ForgetPassword from "../../view/Auth/ForgetPassword.vue";
import Register from "../../view/Auth/Register.vue";
import {defineAsyncComponent} from "vue";

const basicRoute:RouteRecordRaw[]=[
    {
        path:'/',
        name:'',
        redirect:'/home',
    },
    {
        path:'/home',
        name:'主页',
        component:defineAsyncComponent(() => import("../../view/HomePage.vue"))
    },
    {
        path:'/good/:id',
        name:'商品页面',
        component:defineAsyncComponent(() => import("../../view/Goods/Good.vue"))
    },
    {
        path:'/goodList',
        name:'商品总列表',
        component:defineAsyncComponent(() => import("../../view/Goods/GoodList_New.vue")),

        children:[
            {
                path:'/goodList/:type*',
                name:'商品列表',
                component: defineAsyncComponent(() => import("../../view/Goods/GoodItemList.vue"))
            }
        ]
    },
    {
        path:'/user',
        name:'用户',
        redirect:'/user/main',

    },
    {
        path:'/user/main',
        name:'用户主页',
        component: defineAsyncComponent(() => import("../../view/User/UserMain.vue"))
    },
    {
        path:'/user/info',
        name:'用户信息',
        component: defineAsyncComponent(() => import("../../view/User/UserInfo.vue"))
    },
    {
        path:'/user/mail',
        name:'用户邮箱',
        component: defineAsyncComponent(() => import("../../view/User/UserMail.vue"))
    },
    {
        path:'/user/address',
        name:'用户地址',
        component: defineAsyncComponent(() => import("../../view/User/UserAddress.vue"))
    },
    {
        path:'/user/starGood',
        name:'收藏商品',
        component: defineAsyncComponent(() => import("../../view/Goods/StarGoodList.vue"))
    },
    {
        path:'/user/phone',
        name:'用户电话',
        component: defineAsyncComponent(() => import("../../view/User/UserPhone.vue"))
    },
    {
        path:'/user/shopCart',
        name:'用户购物车',
        component: defineAsyncComponent(() => import("../../view/User/cart/ShopCart.vue"))
    },
    {
        path:'/user/historicalOrderList',
        name:'历史订单',
        component: defineAsyncComponent(() => import("../../view/User/cart/HistoricalOrderList.vue"))
    },
    {
        path:'/user/order/:id',
        name:'订单',
        component: defineAsyncComponent(() => import("../../view/User/cart/HistoricalOrder.vue"))
    },
    {
        path:'/public/page/:id',
        name:'自定义页面',
        component: defineAsyncComponent(() => import("../../view/other/SelfDefinePage.vue"))
    },
    {
        path:'/public/page',
        redirect:'/'
    },
    {
        path:'/public',
        redirect:'/'
    },
    {
        path:'/user/toSubmitOrder',
        name:'提交订单页面',
        component: defineAsyncComponent(() => import("../../view/User/cart/ToSubmitOrder.vue"))
    },
    {
        path:'/success/order/pay',
        name:'订单支付成功',
        component: defineAsyncComponent(() => import("../../view/other/PaySuccess.vue"))
    },
    {
        path:'/fail/order/pay',
        name:'订单支付失败',
        component: defineAsyncComponent(() => import("../../view/other/PayFail.vue"))
    },
    {
        path:'/auth',
        name:'Auth',
        redirect:'/auth/login',
        component:defineAsyncComponent(() => import("../../view/Auth/AuthLayout.vue")),
        children:[
            {
                path:'/auth/login',
                name:'Login',
                component: defineAsyncComponent(() => import("../../view/Auth/Login.vue")),
            },
            {
                path:'/auth/register',
                name:'Register',
                component: defineAsyncComponent(() => import("../../view/Auth/Register.vue")),
            },
            {
                path:'/auth/forgetPassword',
                name:'ForgetPassword',
                component: defineAsyncComponent(() => import("../../view/Auth/ForgetPassword.vue")),
            }
        ]
    },
    {
        path: '/:pathMatch(.*)',
        redirect: '/'
    }
]

export default basicRoute;
